package cn.netdisk.tinynetdisk.aop;


import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * 切面处理类
 */
@Aspect
@Component
public class ControllerResult {


    /**
     * 扫描controller的返回结果
     */
    @Pointcut("execution(* cn.netdisk.tinynetdisk.controller..*.*(..))")
    public void controllerResult() {
    }

    /**
     * 处理controller结果
     *
     * @param proceedingJoinPoint 代理对象
     * @return java.lang.String
     * @date 2022/10/18 9:48
     * @author glq
     */
    @Around(value = "controllerResult()")
    public Object executeResult(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        Object res = proceedingJoinPoint.proceed();
//        System.out.println(res);

        return res;
    }

}
